package com.jms.jmsspring.producer;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.jms.*;

/**
 * @Description
 * @Author
 * @Date 2020/3/18 19:26
 **/
public class ProducerServiceImpl implements ProducerService {

    @Autowired
    JmsTemplate jmsTemplate;
    @Resource(name = "queueDestination")
    Destination destination;
    @Override
    public void sendMessage(final String message){
        jmsTemplate.send(destination, session -> session.createTextMessage(message));
        System.out.println(" 消息发送成功!");
    }
}
